package br.usp.ime.mac.mico.models.tests;

import br.usp.ime.mac.mico.models.Box;
import br.usp.ime.mac.mico.models.Place;
import junit.framework.TestCase;

public class PlaceTest extends TestCase {

	private Place placeA;
	private Place placeB;
	private Box box;

	@Override
	public void setUp () {
		box    = new Box();
		placeA = new Place(0, 0, box);
		placeB = new Place(1, 1, box);
	}

	public void testGettersAndSetters () {
		assertEquals(placeA.getIndexX(), 0);
		assertEquals(placeA.getIndexY(), 0);
		assertEquals(placeA.getBox(), box);

		assertEquals(placeB.getIndexX(), 1);
		assertEquals(placeB.getIndexY(), 1);
		assertEquals(placeB.getBox(), box);
	}

	public void testEquals() {
		assertFalse(placeA.equals(null));
		assertFalse(placeA.equals(placeB));
		assertTrue(placeA.equals(placeA));

		placeB = new Place(0, 0, box);
		assertTrue(placeA.equals(placeB));
		placeB = new Place(0, 0, new Box());
		assertFalse(placeA.equals(placeB));
	}
}
